a = {'Alice': 8, 'Bob': 9, 'Charlie': 7, 'David': 10}
b = {'Alice': 9, 'Bob': 8, 'Eve': 9, 'David': 9}

c = [name for name in a.keys() & b.keys()
     if a[name] >=9 and b[name] >=9]

print("任务6: 两次测验都获得9分或以上的学生:", c)